#define GOOGLE_GLOG_DLL_DECL           
#define GLOG_NO_ABBREVIATED_SEVERITIES  
#define GLOG_EXPORT  
#define GLOG_NO_EXPORT 
#include <gtest/gtest.h>             
#include <gtest/stub.h>              
#include <glog/logging.h>            
#include <iostream>
#include "queue_linked_list.h"   
#include "queue_array.h"                
using namespace std;       
using namespace std::chrono_literals;                           
/*-----------------BEGIN----------------*/ 
int queue_linked_list_main(void)
{
	LinkedListQueue q;
	QueueInit(&q);
	QueuePush(&q, 1);
	QueuePush(&q, 2);
	QueuePush(&q, 3);
	QueuePush(&q, 4);
    LOG(INFO) << "the queue front value: "  << QueueFront(&q);
    LOG(INFO) << "the queue back  value: "  << QueueBack( &q);
    LOG(INFO) << "the queue size  value: "  << QueueSize( &q);
	QueuePop(&q);//出队列
    LOG(INFO) << "the queue front value: "  << QueueFront(&q);
    LOG(INFO) << "the queue back  value: "  << QueueBack( &q);
    LOG(INFO) << "the queue size  value: "  << QueueSize( &q);
	return 0;
}
void printQueueArray(ArrayQueue *q)
{
    if (isEmpty(q))
    {
        return;
    }
    int i = q->front;
    for (int j = 0; j < q->size; j++)
    {
        LOG(INFO) << "the queue data value: " << q->data[i];
        i = (i + 1) % MAX_SIZE;
    }
}
int queue_array_main(void)
{
    ArrayQueue q;
    initQueue(&q);
    // 往队列内插入元素
    enqueue(&q, 10);
    enqueue(&q, 20);
    enqueue(&q, 30);
    enqueue(&q, 40);
    printQueueArray(&q);
    LOG(INFO) << "the queue size value: "  << getQueueSize(&q);
    dequeue(&q);
    printQueueArray(&q);
    LOG(INFO) << "the queue size value: "  << getQueueSize(&q);
    return 0;
}
TEST(TestSuite0, TEST1){
    LOG(INFO) << "\r\nUT >>>  queue_linked_list_main";
    queue_linked_list_main();
}
TEST(TestSuite0, TEST2){
    LOG(INFO) << "\r\nUT >>>  queue_array_main";
    queue_array_main();
}
/*------------------END-----------------*/     
int gtest_main(int argc, char *argv[]){       
    google::InitGoogleLogging("UNITTEST");      
    google::SetStderrLogging(google::GLOG_INFO);   
    google::SetLogDestination(google::GLOG_INFO, ".//log//INFO_"); 
    google::EnableLogCleaner(2); 
    //init global variable                
                                               
    testing::InitGoogleTest(&argc, argv); 
    return RUN_ALL_TESTS();                
    google::ShutdownGoogleLogging();       
}                                              

// ******************* (C) COPYRIGHT 2025 PHOTONIC *****END OF FILE**********************